<script src="<?php echo DOMAIN?>/js/jquery-treeview-003.js" type="text/javascript"></script>
<link rel="stylesheet" href="<?php echo DOMAIN?>/css/jquery-treeview.css">


<script language="javascript" type="text/javascript">
/*<![CDATA[*/
	$(function(){
		$("#lnkSave").click(function(){
			$('#adminForm').submit();
		});

		$("#lnkClose").click(function(){
			window.location = '<?php echo DOMAIN?>/incomes';
		});

	});
/*]]>*/
	function Checkvalue(ElementID){
		var checkBox = document.getElementById(ElementID);
		if(checkBox.checked==true)
			checkBox.value=1; 
		else checkBox.value=0; 
	}
	$(document).ready(function(){
		$("#treeView").treeview({
			   collapsed: true
		});
	});

</script>
<style>
div.width-50 {
    margin-left: 200px;
    width: 70%;
}
</style>
<div id="content-box">
	<div class="border">
		<div class="padding">
			<div id="toolbar-box">
   			<div class="t"><div class="t"><div class="t"></div></div></div>
			<div class="m">
				<div class="toolbar" id="toolbar">
				<table class="toolbar">
				<tr>
					
					<td class="button" id="toolbar-cancel">
					<a href="javascript:;//Đóng" id="lnkClose" class="toolbar">
						<span class="icon-32-cancel" title="Đóng"></span>
						Đóng
					</a>
					</td>
				</tr>
				</table>
				</div>
				<div class="header icon-48-langmanager">Chi tiết cấp bậc và số PV của thanh viên</div>
				<div class="clr"></div>
			</div>
			<div class="b"><div class="b"><div class="b"></div></div></div>
			</div>
			<div class="clr"></div>
			<div id="element-box">
				<div class="t"><div class="t"><div class="t"></div></div></div>
				<div class="m">
				<div id="contents" title="" style="overflow:none;"> 
                     <fieldset class="adminform">
					<legend>Thông tin cấp bậc và PV</legend>
                        <table  cellspacing="1" cellpadding="1" border="0" bgcolor="#CCCCCC">
                              <tbody>
                              <tr>
                                <td width="400" bgcolor="#EAF1F7" style="padding-left:20px;">&nbsp;</td>
                                <td bgcolor="#EAF1F7" align="center" colspan="2">
                         <table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="#CCCCCC" align="center">
                               <tbody>
                               <tr bgcolor="#FFFFFF"  height="28">
                                    <td bgcolor="#EAF1F7" align="center" style="padding-left:20px;" colspan="2">
                                        <form action="<?php echo DOMAIN?>/incomes/view/<?php echo $this->data['Member']['id']?>" method="post" id="monthForm">
                                          <?php
                                              $curMonth = date("m");
                                              $curYear = date("Y");
                                              $months = array("0" => "Tháng " . ($curMonth) . "-$curYear");
                                              
                                              for($i=1; $i<6; $i++){
                                                  if (date("m", strtotime($this->data['Member']['created']))<=$curMonth-$i){
                                                    $months[($curMonth-$i) . "-$curYear"] = "Tháng " . ($curMonth-$i) . "-$curYear";
                                                  }
                                              }
                                              echo $this->Form->input('month',
                                                         array(
                                                             'label'=>'',
                                                             'id'=>'month',
                                                             'class'=>'inputbox',
                                                             'options' => $months,
                                                             'onchange' => 'jQuery(\'#monthForm\').submit();',
                                                         )
                                                     );
                                          ?>
                                        </form>
                                    </td>
                               </tr>
                               <tr height="28">
                                    <td width="50%" bgcolor="#EAF1F7" align="center">VNĐ</td>
                                    <td width="50%" bgcolor="#EAF1F7" align="center">PV </td>
                               </tr>
                              </tbody>
                         </table>
                       </td>
           
                    </tr>	    
                    <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" align="left" style="padding-left : 20px;">Thành tích cá nhân</td>
                    <td width="20%" style="padding-right: 20px;"><?php echo number_format($member['personal_pv']*20000, 0, ',' , '.');?> VNĐ</td>
                    <td width="20%"> <?php echo number_format($member['personal_pv'], 0, ',' , '.');?></td>
                   
                    </tr>
                    <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" style="padding-left : 20px;">Thành tích nhóm</td>
                    <td width="20%"><?php echo number_format($member['group_pv']*20000, 0, ',' , '.');?> VNĐ</td>
                    <td width="20%"> <?php echo number_format($member['group_pv'], 0, ',' , '.');?></td>
                    
                    </tr>
                    <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" style="padding-left : 20px;">Hoa hồng trực tiếp</td>
                    <td width="20%"><?php echo number_format($member['direct_commission']*20000, 0, ',' , '.');?> VNĐ</td>
                    <td width="20%"> <?php echo number_format($member['direct_commission'], 0, ',' , '.');?></td>
                    
                    </tr>  
                    <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" style="padding-left : 20px;">Hoa hồng gián tiếp</td>
                    <td width="20%"><?php echo number_format($member['indirect_commission']*20000, 0, ',' , '.');?> VNĐ</td>
                    <td width="20%"> <?php echo number_format($member['indirect_commission'], 0, ',' , '.');?></td>
                    
                    </tr> 
                    <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" style="padding-left : 20px;">Hoa hồng lãnh đạo</td>
                    <td width="20%"><?php echo number_format($member['lead_commission']*20000, 0, ',' , '.');?> VNĐ</td>
                    <td width="20%"> <?php echo number_format($member['lead_commission'], 0, ',' , '.');?></td>
                    
                    </tr> 
                    <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" style="padding-left : 20px;">Hoa hồng toàn cầu</td>
                    <td width="20%">0 VNĐ</td>
                    <td width="20%"> 0</td>
                    
                    </tr> 
                     <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" style="padding-left : 20px;">Hoa hồng đặc biệt</td>
                    <td width="20%">0</td>
                    <td width="20%"> 0</td>
                    
                    </tr> 
                      <tr bgcolor="#FFFFFF"  height="28">
                    <td width="20%" style="padding-left : 20px;">Hoa hồng trọn đời</td>
                    <td width="20%">0</td>
                    <td width="20%"> 0</td>
                    
                    </tr>
                     
                   </tbody></table>
                     <p style="font-size:12px; font-weight:bold;">Level của bạn  : <span style="color:#F00"><?php echo $namesOfLevel[$member['levels']];?> </span></p>
                     <p style="font-size:12px; font-weight:bold;">Level của bạn theo tích lũy tháng hiện tại : <span style="color:#F00"><?php echo $namesOfLevel[$member['tmp_levels']];?> </span></p>
                     <p style="font-size:12px; font-weight:bold;">Tổng thành tích cá nhân tích lũy từ khi ra nhập : <span style="color:#F00"><?php echo $member['total_personal_pv'];?> PV </span></p>
                     <?php if (!empty($member['missing_personal_pv'])){?>
                     <p style="font-size:12px; font-weight:bold;">Thành tích cá nhân còn thiếu để được hoa hồng gián tiếp theo level hiện tại : <span style="color:#F00"><?php echo $member['missing_personal_pv'];?> PV </span></p>
                     <?php }?>
                     <?php if ($member['levels']>=6 && isset($member['missing_group_pv'])) {?>
                     <p style="font-size:12px; font-weight:bold;">Thành tích nhóm còn thiếu để được hoa hồng lãnh đạo: <span style="color:#F00"><?php echo $member['missing_group_pv'];?> PV </span></p>
                     <?php }?>
                     <p style="font-size:12px; font-weight:bold;">Lương trước thuế của bạn trong tháng này  : <span style="color:#F00">
                        <?php echo number_format($member['commission']*20000, 0, ',' , '.');?>  VNĐ </span>
                     </p>
                     <p style="font-size:12px; font-weight:bold;">Thuế thu nhập của bạn trong tháng này  : 
                        <span style="color:#F00">
                            <?php echo number_format($member['personal_income_tax']*20000, 0, ',' , '.');?>  VNĐ 
                        </span>
                     </p>
                     <p style="font-size:12px; font-weight:bold;">Lương sau thuế của bạn trong tháng này : 
                        <span style="color:#F00">
                            <?php echo number_format(($member['commission']*20000 - $member['personal_income_tax']*20000), 0, ',' , '.');?>  VNĐ 
                        </span>
                     </p>
                  </fieldset>    
                  	<fieldset class="adminform">
					<legend>Thông tin thành viên</legend>
                  <table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="" align="center">
                     <tr bgcolor="#FFFFFF"  height="28">
                        <td  width="25%" class="bg_form_left">Họ và tên </td>
                        <td class="bg_form_right"><?php echo $this->data['Member']['name']?></td>
                      </tr>
                      <tr bgcolor="#FFFFFF"  height="28">
                        <td class="bg_form_left">Tài khoản đằng nhập</td>
                        <td class="bg_form_right"> <?php echo $this->data['Member']['user'] ?> </td>
                      </tr>
                      
                    <!--  <tr bgcolor="#FFFFFF"  height="28">
                        <td  class="bg_form_left">Cấp trên</td>
                        <td class="bg_form_right"><?php echo $this->data['ParentCat']['name']?></td>
                      </tr>
                      <tr bgcolor="#FFFFFF"  height="28">
                        <td class="bg_form_left">Tài khoản cấp trên</td>
                        <td  class="bg_form_right"><?php echo $this->data['ParentCat']['user']?></td>
                      </tr>-->
                       <tr bgcolor="#FFFFFF"  height="28">
                        <td valign="top" class="bg_form_left">Điện thoại</td>
                        <td  class="bg_form_right"><?php echo $this->data['Member']['mobile']?></td>
                      </tr>
                       <tr bgcolor="#FFFFFF"  height="28">
                        <td  class="bg_form_left">Địa chỉ </td>
                        <td class="bg_form_right"><?php echo $this->data['Member']['add']?></td>
                      </tr>
                      <tr bgcolor="#FFFFFF"  height="28">
                        <td  class="bg_form_left">Email</td>
                        <td class="bg_form_right"><?php echo $this->data['Member']['email']?></td>
                      </tr>
                       <tr bgcolor="#FFFFFF"  height="28">
                        <td  class="bg_form_left">Yahoo </td>
                        <td class="bg_form_right"><?php echo $this->data['Member']['yahoo']?></td>
                      </tr>
                        <tr bgcolor="#FFFFFF"  height="28">
                        <td  class="bg_form_left">Skype</td>
                        <td class="bg_form_right"><?php echo $this->data['Member']['skype']?></td>
                      </tr>
                     
                    </table>
                    </fieldset>

					<fieldset class="adminform">
						<legend>Thông tin thành viên cấp dưới</legend>
						<table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="" align="center">
							<tr bgcolor="#FFFFFF" height="28"><td>
								<ul id="treeView" class="filetree treeview-red treeview">
									<?php echo $viewTree;?>
								</ul>
								</td>
							</tr>
	
						</table>
					</fieldset>

                    </div>
				<div class="clr"></div>
				</div>
				<div class="b"><div class="b"><div class="b"></div></div></div>
			</div>
			<noscript>Warning! JavaScript must be enabled for proper operation of the Administrator back-end.</noscript>
			<div class="clr"></div>
		</div>
		<div class="clr"></div>
	</div>
</div>
